package com.wxw.BaseLibrary.element;

import com.wxw.BaseLibrary.adapter.ObjectListAdapter;

/**
 * Created by david on 2014-06-05.
 */
public class ElementStatus {
    private Object object = null;
    private boolean checked = false;
    private int index = 10000;
    private boolean changed = false;
    private int status = -1;

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        changed = !object.equals(this.object);
        this.object = object;
    }

    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        changed = this.checked != checked;
        this.checked = checked;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        changed = this.index != index;
        this.index = index;
    }

    public boolean isChanged() {
        return changed;
    }

    public void setChanged(boolean changed){
        this.changed = changed;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public ElementStatus(){}

    public ElementStatus(Object o, boolean checked, int index){
        this.object = o;
        this.checked = checked;
        this.index = index;
    }

    public ElementStatus(Object o,boolean checked, int index, int status){
        this.object = o;
        this.checked = checked;
        this.index = index;
        this.status = status;
    }

    @Override
    public String toString() {
        return object==null?super.toString():object.toString();
    }
}
